<?php
session_start();
if(!$_SESSION["trv3_07"]){
	header("location:../../login.php");
	exit;
}
require "../../resources/v1.php";
$conexion = server_reconnect();

$query = "select * from `exp` e where e.`est`=20 and e.`autos` not in(select t.`autos` from `trace` t where t.`act`=91 or t.`act`=92 or t.`act`=93)";
$result = mysql_query( $query, $conexion);
while ($mxcel = @mysql_fetch_array($result)){
	
	$Autos = $mxcel['autos'];
	$Tip = $mxcel['tip'];
	
	$query = "update `mul` set `activa`=0 where `autos`=".$Autos." and `tip`=".$Tip;
	mysql_query( $query, $conexion);
	$query = "insert into `mul` (`pre`,`sen`,`real`,`fech`,`autos`,`tip`,`activa`) values (0,0,0,date(now()),".$Autos.",".$Tip.",1)";
	mysql_query( $query, $conexion);
	$IDMulta = mysql_insert_id( $conexion);
	$query = "Insert into `trace` (`autos`,`tip`,`act`,`fech`,`usr`,`aux`) values (".$Autos.",".$Tip.",50,Now(),1,".$IDMulta.")";
	mysql_query( $query, $conexion);

}

server_disconnect( $conexion);
?>